var WxParse = require('../../wxParse/wxParse.js');
Page({
    data: {
        current: 0,
        src: 'https://b.bdstatic.com/swan-temp/940fe716b0eaad38f47b209d61657490.mp4',
        loop: false,
        autoplay: false
    },
    product: function (e) {
        swan.switchTab({
            url: '../product/product'
        });
    },
    onShow() {
        let that = this;
        // 监听页面显示的生命周期函数
        this.setData({
            data: swan.getStorageSync('prodetail')
        });
        WxParse.wxParse('article', 'html', this.data.data.content, that, 5);
    },
    tiaozhuan(e){
        console.log(e)
        swan.setStorageSync('productDetail',e.currentTarget.dataset.item);
        swan.navigateTo({
            url: '../productDetail/productDetail'
        });
    },
    play: function (e) {
        console.log('play!');
    },
    pause: function (e) {
        console.log('pause');
    },
    fullscreen: function (e) {
        console.log('fullscreenchange!! 参数是' + JSON.stringify(e));
    },
    ended: function (e) {
        console.log('ended');
        this.next();
    },
    next: function (e) {
        let list = this.getData('srcList');
        let current = (this.getData('current') + 1) % list.length;
        this.setData('src', list[current]);
        this.setData('current', current);
    },
    setloop: function (e) {
        this.setData('loop', !this.getData('loop'));
    },
    setautoplay: function (e) {
        let autoplay = this.getData('autoplay');
        this.setData('autoplay', !autoplay);
    }
});